<?php

use App\Enums\OpenShop\InvestmentPromotion\MainProcessEnum;
use App\Models\OpenShop\StartBusiness\OpenShopStartBusinessModel;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateOpenShopStartBusiness extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('open_shop_start_business', function (Blueprint $table) {
            $table->id();

            $table->unsignedInteger('mainProcessId')->default(0)->comment('开店主流程id');
            $table->string('orderNo', 60)->default('')->comment('开店订单号');
            $table->unsignedTinyInteger('step')->default(0)->comment(enumToMigrationComment(MainProcessEnum::MAIN_PROCESS_START_BUSINESS_MAP, "开业步骤"));
            $table->unsignedInteger("submitTime")->default(0)->comment("提交时间");
            $table->unsignedTinyInteger("eatInTotal")->default(0)->comment("堂食位数");
            $table->unsignedTinyInteger("hasMonitorUint")->default(0)->comment(enumToMigrationComment(OpenShopStartBusinessModel::MONITOR_UNIT_MAP, "监控落地"));
            $table->unsignedTinyInteger("hasRight")->default(0)->comment(enumToMigrationComment(OpenShopStartBusinessModel::RIGHT_MAP, "有无竞对"));
            $table->text("rightDetail")->nullable(true)->default("")->comment("竞对信息");
            $table->string("sellChannel", 180)->default("")->comment(enumToMigrationComment(OpenShopStartBusinessModel::SELL_CHANNEL_MAP,"售卖渠道"));
            $table->unsignedTinyInteger("employmentExperience")->default(0)->comment(enumToMigrationComment(OpenShopStartBusinessModel::EMPLOYMENT_EXPERIENCE_MAP,"从业经验"));
            $table->unsignedTinyInteger("managementInput")->default(0)->comment(enumToMigrationComment(OpenShopStartBusinessModel::MANAGEMENT_INPUT_TYPE_MAP,"经营投入"));
            $table->unsignedTinyInteger("degreeCooperation")->default(0)->comment(enumToMigrationComment(OpenShopStartBusinessModel::DEGREE_COOPERATION_TYPE, "配合程度"));
            $table->unsignedInteger("startBusinessTime")->default(0)->comment("开业时间");
            $table->unsignedTinyInteger("sellPriceType")->default(0)->comment(enumToMigrationComment(OpenShopStartBusinessModel::SELL_PRICE_TYPE,"执行售价"));
            $table->string("menuCategory", 180)->default("")->comment(enumToMigrationComment(OpenShopStartBusinessModel::MENU_CATEGORY_TYPE,"菜单品类"));
            $table->unsignedInteger("staffCount")->default(0)->comment("员工数");
            $table->unsignedInteger("monthlyWages")->default(0)->comment("月工资金额");
            $table->text("startBusinessActivityDesc")->nullable(true)->default("")->comment("开业活动描述");
            $table->text("promoteChancePointDesc")->nullable(true)->default("")->comment("提升机会点描述");
            $table->text("leaveBehindQuestionDesc")->nullable(true)->default("")->comment("遗留问题");

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->index(["orderNo"], "idx_orderNo");
            $table->index(["mainProcessId"], "idx_mainProcessId");
            $table->comment = '开店 - 正式开业';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('open_shop_start_business');
    }
}
